home *** CD-ROM | disk | FTP | other *** search
/ How Would You Survive? / How Would You Survive (1995)(Grolier)[Mac-PC].iso / mac / SHARED.DIR / 01978_Script_aBiStableButton < prev    next >
Text File  |  1995-09-13  |  2KB  |  97 lines

  1. property pSprite , pNCast , pHCast , pDCast , pFunction , pLatched, pCursor, pMySound, pRolloverFunction
  2.  
  3. on birth me , theSprite , theNCast, theSound, theFunction, theCursor, theRolloverFunction
  4.   
  5.   set pSprite = theSprite
  6.   set pNCast = theNCast
  7.   set pHCast = pNCast + 1
  8.   set pDCast = pNCast + 2
  9.   set pFunction = theFunction
  10.   set pRolloverFunction = theRolloverFunction
  11.   set pCursor = theCursor
  12.   set pMySound = theSound
  13.   puppetSprite pSprite , TRUE
  14.   set pLatched = FALSE
  15.   return me
  16. end
  17.  
  18. on normalState me
  19.   set pLatched = FALSE
  20.   set the castNum of sprite pSprite = pNCast
  21.   upDateStage
  22. end
  23.  
  24. on hilightState me
  25.   set the castNum of sprite pSprite = pHCast
  26.   upDateStage
  27. end
  28.  
  29. on downState me
  30.   set pLatched = TRUE
  31.   set the castNum of sprite pSprite = pDCast
  32.   upDateStage
  33. end
  34.  
  35. on setlatched me
  36.   set pLatched = TRUE
  37.   set the castNum of sprite pSprite = pHCast
  38.   upDateStage
  39. end
  40.  
  41. on getState me
  42.   return (the castNum of sprite pSprite)
  43. end
  44.  
  45. on testRollover me
  46.   if (rollover(pSprite)) then
  47.     set ret = TRUE
  48.   else
  49.     set ret = FALSE
  50.   end if
  51.   return ret
  52. end
  53.  
  54. on hilight me
  55.   if (not(pLatched)) then
  56.     if (testRollover ( me)) then
  57.       if ( getState (me) = pNCast) then
  58.         hilightState (me)
  59.         do pRolloverFunction
  60.       end if
  61.       if (the mouseDown) then
  62.         puppetsound pMySound
  63.         clearAll
  64.         downState (me)
  65.         do pFunction
  66.       end if
  67.     else
  68.       normalState(me)
  69.     end if
  70.   end if
  71. end
  72.  
  73. on hilight2 me
  74.   if (not(pLatched)) then
  75.     if (testRollover ( me)) then
  76.       if ( getState (me) = pNCast) then
  77.         hilightState (me)
  78.       end if
  79.       if (the mouseDown) then
  80.         puppetsound 0
  81.         puppetsound pMySound
  82.         updatestage
  83.         clearAll
  84.         downState (me)
  85.         do pRolloverFunction
  86.         do pFunction
  87.       end if
  88.     else
  89.       normalState(me)
  90.     end if
  91.   end if
  92. end
  93.  
  94. on reset me
  95.   normalState(me)
  96. end
  97.